﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Lamex.SIESystemManager.Calculate
{
    public class C_D11
    {
        public double[] GetD11(DataRow[] dr1, DataRow[] dr2, DataRow[] dr3)
        {
            //TD11 = 0;
            double MachineValue = 0;
            double[] TD11 = { 0, 0 };
            double TBGD = 0;//固定时间
            double TD11_Drilling_vertical_blind_hole = 0;//D11_钻垂直盲孔
            double TD11_Drilling_vertical_through_hole = 0;//D11_钻垂直通孔
            double TD11_Drilling_Vertical_Sleeve_Hole = 0;//D11_钻垂直套孔
            double TD11_Drilling_horizontal_front_hole = 0;//D11_钻水平前孔
            double TD11_Drilling_Horizontal_Rear_Hole = 0;//D11_钻水平后孔
            double TD11_Horizontal_drilling = 0;//D11_钻水平上孔
            double TD11_Drilling_Horizontal_Downhole = 0;//D11_钻水平下孔
            double TD11_Round_Gong_45_blind_hole = 0;//D11_圆锣45盲孔
            double TD11_Round_Gong_45_through_hole = 0;//圆锣45通孔
            double TD11_Round_Gong_70_blind_hole = 0;//D11_圆锣70盲孔
            double TD11_Round_Gong_70_through_hole = 0;//D11_圆锣70通孔
            double TD11_Round_Gong_71_blind_hole = 0;//D11_圆锣71盲孔
            double TD11_Round_Gong_71_through_hole = 0;//D11_圆锣71通孔
            double TD11_Number_of_special_gongs = 0;//D11_异形锣数量
            double TD11_Length_of_Special_shaped_Gong = 0;//D11_异形锣长度
            double TD11_Width_of_Special_shaped_Gong = 0;//D11_异形锣宽度
            double TD11_Gong_lock_block_hole = 0;//D11_锣锁档片孔
            double TD11_Gong_handle_hole = 0;//D11_锣拉手孔孔
            double TD11_Number_of_sawblade_grooves = 0;//D11_锯片槽数量
            double TD11_Saw_blade_groove_length = 0;//D11_锯片槽长度
            double TD11_Width_of_saw_blade_groove = 0;//D11_锯片槽宽度
            //单位工时
            double WD11_Drilling_vertical_blind_hole = 0;//D11_钻垂直盲孔
            double WD11_Drilling_vertical_through_hole = 0;//D11_钻垂直通孔
            double WD11_Drilling_Vertical_Sleeve_Hole = 0;//D11_钻垂直套孔
            double WD11_Drilling_horizontal_front_hole = 0;//D11_钻水平前孔
            double WD11_Drilling_Horizontal_Rear_Hole = 0;//D11_钻水平后孔
            double WD11_Horizontal_drilling = 0;//D11_钻水平上孔
            double WD11_Drilling_Horizontal_Downhole = 0;//D11_钻水平下孔
            double WD11_Round_Gong_45_blind_hole = 0;//D11_圆锣45盲孔
            double WD11_Round_Gong_45_through_hole = 0;//圆锣45通孔
            double WD11_Round_Gong_70_blind_hole = 0;//D11_圆锣70盲孔
            double WD11_Round_Gong_70_through_hole = 0;//D11_圆锣70通孔
            double WD11_Round_Gong_71_blind_hole = 0;//D11_圆锣71盲孔
            double WD11_Round_Gong_71_through_hole = 0;//D11_圆锣71通孔
            double WD11_Number_of_special_gongs = 0;//D11_异形锣数量
            double WD11_Length_of_Special_shaped_Gong = 0;//D11_异形锣长度
            double WD11_Width_of_Special_shaped_Gong = 0;//D11_异形锣宽度
            double WD11_Gong_lock_block_hole = 0;//D11_锣锁档片孔
            double WD11_Gong_handle_hole = 0;//D11_锣拉手孔孔
            double WD11_Number_of_sawblade_grooves = 0;//D11_锯片槽数量
            double WD11_Saw_blade_groove_length = 0;//D11_锯片槽长度
            double WD11_Width_of_saw_blade_groove = 0;//D11_锯片槽宽度
            //附加工时
            double AD11_Drilling_vertical_blind_hole = 0;//D11_钻垂直盲孔
            double AD11_Drilling_vertical_through_hole = 0;//D11_钻垂直通孔
            double AD11_Drilling_Vertical_Sleeve_Hole = 0;//D11_钻垂直套孔
            double AD11_Drilling_horizontal_front_hole = 0;//D11_钻水平前孔
            double AD11_Drilling_Horizontal_Rear_Hole = 0;//D11_钻水平后孔
            double AD11_Horizontal_drilling = 0;//D11_钻水平上孔
            double AD11_Drilling_Horizontal_Downhole = 0;//D11_钻水平下孔
            double AD11_Round_Gong_45_blind_hole = 0;//D11_圆锣45盲孔
            double AD11_Round_Gong_45_through_hole = 0;//圆锣45通孔
            double AD11_Round_Gong_70_blind_hole = 0;//D11_圆锣70盲孔
            double AD11_Round_Gong_70_through_hole = 0;//D11_圆锣70通孔
            double AD11_Round_Gong_71_blind_hole = 0;//D11_圆锣71盲孔
            double AD11_Round_Gong_71_through_hole = 0;//D11_圆锣71通孔
            double AD11_Number_of_special_gongs = 0;//D11_异形锣数量
            double AD11_Length_of_Special_shaped_Gong = 0;//D11_异形锣长度
            double AD11_Width_of_Special_shaped_Gong = 0;//D11_异形锣宽度
            double AD11_Gong_lock_block_hole = 0;//D11_锣锁档片孔
            double AD11_Gong_handle_hole = 0;//D11_锣拉手孔孔
            double AD11_Number_of_sawblade_grooves = 0;//D11_锯片槽数量
            double AD11_Saw_blade_groove_length = 0;//D11_锯片槽长度
            double AD11_Width_of_saw_blade_groove = 0;//D11_锯片槽宽度

            //获取数据库每个工序动作的单位工时和附加工时
            foreach (var drHours in dr2)
            {
                switch (drHours["OPERATIONAL_NAME"].ToString())
                {
                    case "P钻垂直盲孔":
                        WD11_Drilling_vertical_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Drilling_vertical_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P钻垂直通孔":
                        WD11_Drilling_vertical_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Drilling_vertical_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P钻垂直套孔":
                        WD11_Drilling_Vertical_Sleeve_Hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Drilling_Vertical_Sleeve_Hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P钻水平前孔":
                        WD11_Drilling_horizontal_front_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Drilling_horizontal_front_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P钻水平后孔":
                        WD11_Drilling_Horizontal_Rear_Hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Drilling_Horizontal_Rear_Hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P钻水平上孔":
                        WD11_Horizontal_drilling = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Horizontal_drilling = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P钻水平下孔":
                        WD11_Drilling_Horizontal_Downhole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Drilling_Horizontal_Downhole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P圆锣45盲孔":
                        WD11_Round_Gong_45_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Round_Gong_45_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P圆锣45通孔":
                        WD11_Round_Gong_45_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Round_Gong_45_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P圆锣70盲孔":
                        WD11_Round_Gong_70_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Round_Gong_70_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P圆锣70通孔":
                        WD11_Round_Gong_70_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Round_Gong_70_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P圆锣71盲孔":
                        WD11_Round_Gong_71_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Round_Gong_71_blind_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P圆锣71通孔":
                        WD11_Round_Gong_71_through_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Round_Gong_71_through_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P异形锣数量":
                        WD11_Number_of_special_gongs = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Number_of_special_gongs = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P异形锣长度":
                        WD11_Length_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Length_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P异形锣宽度":
                        WD11_Width_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Width_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P锣锁档片孔":
                        WD11_Gong_lock_block_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Gong_lock_block_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P锣拉手孔":
                        WD11_Gong_handle_hole = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Gong_handle_hole = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P锯片槽数量":
                        WD11_Number_of_sawblade_grooves = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Number_of_sawblade_grooves = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P锯片槽长度":
                        WD11_Saw_blade_groove_length = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Saw_blade_groove_length = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                    case "P锯片槽宽度":
                        WD11_Width_of_saw_blade_groove = double.Parse(string.IsNullOrEmpty(drHours["UNIT_WORKHOURS"].ToString()) ? "0" : drHours["UNIT_WORKHOURS"].ToString());//单位工时
                        AD11_Width_of_saw_blade_groove = double.Parse(string.IsNullOrEmpty(drHours["ATTACH_WORKHOURS"].ToString()) ? "0" : drHours["ATTACH_WORKHOURS"].ToString());//附加工时
                        break;
                }
            }
            foreach (var drData in dr1)
            {
                TD11_Drilling_vertical_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Drilling_vertical_blind_hole"].ToString()) ? "0" : drData["D11_Drilling_vertical_blind_hole"].ToString());//D11_钻垂直盲孔
                TD11_Drilling_vertical_through_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Drilling_vertical_through_hole"].ToString()) ? "0" : drData["D11_Drilling_vertical_through_hole"].ToString());//D11_钻垂直通孔
                TD11_Drilling_Vertical_Sleeve_Hole = double.Parse(string.IsNullOrEmpty(drData["D11_Drilling_Vertical_Sleeve_Hole"].ToString()) ? "0" : drData["D11_Drilling_Vertical_Sleeve_Hole"].ToString());//D11_钻垂直套孔
                TD11_Drilling_horizontal_front_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Drilling_horizontal_front_hole"].ToString()) ? "0" : drData["D11_Drilling_horizontal_front_hole"].ToString());//D11_钻水平前孔
                TD11_Drilling_Horizontal_Rear_Hole = double.Parse(string.IsNullOrEmpty(drData["D11_Drilling_Horizontal_Rear_Hole"].ToString()) ? "0" : drData["D11_Drilling_Horizontal_Rear_Hole"].ToString());//D11_钻水平后孔        
                TD11_Horizontal_drilling = double.Parse(string.IsNullOrEmpty(drData["D11_Horizontal_drilling"].ToString()) ? "0" : drData["D11_Horizontal_drilling"].ToString());//D11_钻水平上孔
                TD11_Drilling_Horizontal_Downhole = double.Parse(string.IsNullOrEmpty(drData["D11_Drilling_Horizontal_Downhole"].ToString()) ? "0" : drData["D11_Drilling_Horizontal_Downhole"].ToString());//D11_钻水平下孔
                TD11_Round_Gong_45_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Round_Gong_45_blind_hole"].ToString()) ? "0" : drData["D11_Round_Gong_45_blind_hole"].ToString());//D11_圆锣45盲孔
                TD11_Round_Gong_45_through_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Round_Gong_45_through_hole"].ToString()) ? "0" : drData["D11_Round_Gong_45_through_hole"].ToString());//圆锣45通孔
                TD11_Round_Gong_70_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Round_Gong_70_blind_hole"].ToString()) ? "0" : drData["D11_Round_Gong_70_blind_hole"].ToString());//D11_圆锣70盲孔
                TD11_Round_Gong_70_through_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Round_Gong_70_through_hole"].ToString()) ? "0" : drData["D11_Round_Gong_70_through_hole"].ToString());//D11_圆锣70通孔
                TD11_Round_Gong_71_blind_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Round_Gong_71_blind_hole"].ToString()) ? "0" : drData["D11_Round_Gong_71_blind_hole"].ToString());//D11_圆锣71盲孔
                TD11_Round_Gong_71_through_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Round_Gong_71_through_hole"].ToString()) ? "0" : drData["D11_Round_Gong_71_through_hole"].ToString());//D11_圆锣71通孔
                TD11_Number_of_special_gongs = double.Parse(string.IsNullOrEmpty(drData["D11_Number_of_special_gongs"].ToString()) ? "0" : drData["D11_Number_of_special_gongs"].ToString());//D11_异形锣数量
                TD11_Length_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drData["D11_Length_of_Special_shaped_Gong"].ToString()) ? "0" : drData["D11_Length_of_Special_shaped_Gong"].ToString());//D11_异形锣长度
                TD11_Width_of_Special_shaped_Gong = double.Parse(string.IsNullOrEmpty(drData["D11_Width_of_Special_shaped_Gong"].ToString()) ? "0" : drData["D11_Width_of_Special_shaped_Gong"].ToString());//D11_异形锣宽度
                TD11_Gong_lock_block_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Gong_lock_block_hole"].ToString()) ? "0" : drData["D11_Gong_lock_block_hole"].ToString());//D11_锣锁档片孔
                TD11_Gong_handle_hole = double.Parse(string.IsNullOrEmpty(drData["D11_Gong_handle_hole"].ToString()) ? "0" : drData["D11_Gong_handle_hole"].ToString());//D11_锣拉手孔孔
                TD11_Number_of_sawblade_grooves = double.Parse(string.IsNullOrEmpty(drData["D11_Number_of_sawblade_grooves"].ToString()) ? "0" : drData["D11_Number_of_sawblade_grooves"].ToString());//D11_锯片槽数量
                TD11_Saw_blade_groove_length = double.Parse(string.IsNullOrEmpty(drData["D11_Saw_blade_groove_length"].ToString()) ? "0" : drData["D11_Saw_blade_groove_length"].ToString());//D11_锯片槽长度
                TD11_Width_of_saw_blade_groove = double.Parse(string.IsNullOrEmpty(drData["D11_Width_of_saw_blade_groove"].ToString()) ? "0" : drData["D11_Width_of_saw_blade_groove"].ToString());//D11_锯片槽宽度
            }
            //所有时间
            if (TD11_Drilling_vertical_blind_hole!=0||TD11_Drilling_vertical_through_hole!=0||TD11_Drilling_Vertical_Sleeve_Hole!=0||
                TD11_Drilling_horizontal_front_hole != 0 || TD11_Drilling_Horizontal_Rear_Hole != 0 || TD11_Horizontal_drilling!=0||
                TD11_Drilling_Horizontal_Downhole != 0 || TD11_Round_Gong_45_blind_hole != 0 || TD11_Round_Gong_45_through_hole!=0||
                TD11_Round_Gong_70_blind_hole != 0 || TD11_Round_Gong_70_through_hole != 0 || TD11_Round_Gong_71_blind_hole!=0||
                TD11_Round_Gong_71_through_hole != 0 || TD11_Number_of_special_gongs != 0 || TD11_Length_of_Special_shaped_Gong!=0||
                TD11_Width_of_Special_shaped_Gong != 0 || TD11_Gong_lock_block_hole != 0 || TD11_Gong_handle_hole!=0||
                TD11_Number_of_sawblade_grooves != 0 || TD11_Saw_blade_groove_length != 0 || TD11_Width_of_saw_blade_groove!=0)
            {
                TBGD = 10;
            }
            if (dr3 != null)
            {
                foreach (var drMachine in dr3)
                {
                    MachineValue = Convert.ToDouble(drMachine["Process_Time"]);
                }
            }
            if (MachineValue != 0)
            {
                #region 机器工时
                TD11[0] = MachineValue + TBGD;
                TD11[1] = 1;
                #endregion
            }

            else
            {
                #region 逻辑工时
                if (TD11_Drilling_vertical_blind_hole != 0)
                {
                    TD11[0] = WD11_Drilling_vertical_blind_hole * TD11_Drilling_vertical_blind_hole + AD11_Drilling_vertical_blind_hole;
                }
                if (TD11_Drilling_vertical_through_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Drilling_vertical_through_hole * TD11_Drilling_vertical_through_hole + AD11_Drilling_vertical_through_hole;
                }
                if (TD11_Drilling_Vertical_Sleeve_Hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Drilling_Vertical_Sleeve_Hole * TD11_Drilling_Vertical_Sleeve_Hole + AD11_Drilling_Vertical_Sleeve_Hole;
                }
                if (TD11_Drilling_horizontal_front_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Drilling_horizontal_front_hole * TD11_Drilling_horizontal_front_hole + AD11_Drilling_horizontal_front_hole;
                }
                if (TD11_Drilling_Horizontal_Rear_Hole != 0)
                {
                    TD11[0] = TD11[0] + ((WD11_Drilling_Horizontal_Rear_Hole * TD11_Drilling_Horizontal_Rear_Hole) + AD11_Drilling_Horizontal_Rear_Hole);
                }
                if (TD11_Horizontal_drilling != 0)
                {
                    TD11[0] = TD11[0] + WD11_Horizontal_drilling * TD11_Horizontal_drilling + AD11_Horizontal_drilling;
                }
                if (TD11_Drilling_Horizontal_Downhole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Drilling_Horizontal_Downhole * TD11_Drilling_Horizontal_Downhole + AD11_Drilling_Horizontal_Downhole;
                }
                if (TD11_Round_Gong_45_blind_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Round_Gong_45_blind_hole * TD11_Round_Gong_45_blind_hole + AD11_Round_Gong_45_blind_hole;
                }
                if (TD11_Round_Gong_45_through_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Round_Gong_45_through_hole * TD11_Round_Gong_45_through_hole + AD11_Round_Gong_45_through_hole;
                }
                if (TD11_Round_Gong_70_blind_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Round_Gong_70_blind_hole * TD11_Round_Gong_70_blind_hole + AD11_Round_Gong_70_blind_hole;
                }
                if (TD11_Round_Gong_70_through_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Round_Gong_70_through_hole * TD11_Round_Gong_70_through_hole + AD11_Round_Gong_70_through_hole;
                }
                if (TD11_Round_Gong_71_blind_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Round_Gong_71_blind_hole * TD11_Round_Gong_71_blind_hole + AD11_Round_Gong_71_blind_hole;
                }
                if (TD11_Round_Gong_71_through_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Round_Gong_71_through_hole * TD11_Round_Gong_71_through_hole + AD11_Round_Gong_71_through_hole;
                }
                if (TD11_Number_of_special_gongs != 0 || TD11_Length_of_Special_shaped_Gong != 0 || TD11_Width_of_Special_shaped_Gong != 0)
                {
                    TD11[0] = TD11[0] + TD11_Number_of_special_gongs *
                           ((TD11_Length_of_Special_shaped_Gong * TD11_Width_of_Special_shaped_Gong * 0.0024456) + 6);
                }
                if (TD11_Gong_lock_block_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Gong_lock_block_hole * TD11_Gong_lock_block_hole + AD11_Gong_lock_block_hole;
                }
                if (TD11_Gong_handle_hole != 0)
                {
                    TD11[0] = TD11[0] + WD11_Gong_handle_hole * TD11_Gong_handle_hole + AD11_Gong_handle_hole;
                }
                if (TD11_Number_of_sawblade_grooves != 0 || TD11_Saw_blade_groove_length != 0 || TD11_Width_of_saw_blade_groove != 0)
                {
                    TD11[0] = TD11[0] + TD11_Number_of_sawblade_grooves *
                        ((TD11_Saw_blade_groove_length * 0.00573 * (Math.Ceiling(TD11_Width_of_saw_blade_groove / 7))) +
                        (3 * Math.Ceiling(TD11_Width_of_saw_blade_groove / 7)));
                }
                //总工时
                if (TD11[0] == 0)
                {
                    TD11[0] = 0;
                }
                else
                {
                    TD11[0] = TD11[0] + TBGD;
                }
                TD11[1] = 0;
                #endregion
            }

            return TD11;
        }
    }
}
